<?php

namespace App\Http\Controllers;

use App\http\Model\loginModel;
use Illuminate\Http\Request;

class loginController extends Controller
{
    //
    function loginAdd(Request $request){
        //获取数据
        $username=$request->input('username');
        $password=$request->input('password');
       //实例化模型
        $model=new loginModel();
        //调用模型方法
        $mothod=$model->loginAdd($username);
        if(!$mothod){
            echo "<script>alert('用户名错误');</script>";
        }
        if($mothod->password!=$password){

         return redirect('staff');

        }
        session (['user'=>$mothod]);
        redirect('staffShow');

    }
}
